package com.etime.shycourse.controller.wx.applets.controller;

import com.etime.shy.common.ListMessage;
import com.etime.shycourse.pojo.Sysbanner;
import com.etime.shycourse.services.interfaces.WxSysbannerServices;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName : WxSysbannerController  //类名
 * @Description : 微信小程序的接口  //描述
 * @Author : W //作者
 * @Date: 2022/1/5  9:28
 */
@Api(tags = "微信小程序的banner接口")
@RestController
@RequestMapping("/wx/banner")
public class WxSysBannerController {
    @Autowired
    WxSysbannerServices services;

    @ApiOperation("课程banner 取课程前3条记录")
    @GetMapping("/list")
    public ListMessage<Sysbanner> selectCourseRecommendation() {
        ListMessage<Sysbanner> msg = new ListMessage<> ();
        List<Sysbanner> data = services.selectSysBannerList ();
        if (data != null) {
            msg.setCode (1);
            msg.setDatalist (data);
        } else {
            msg.setCode (0);
            msg.setMsg ("没有banner推荐的数据");
        }
        return msg;
    }
}

